package top.cwk.controller.customer;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import top.cwk.api.customer.ICustomerService;
import top.cwk.model.customerPo.Customer;


@Controller
public class CustomerController {

	@Autowired
	private ICustomerService customerService;
	
	@RequestMapping("/sayHello")
	public String toHello(){
		customerService.sayHello();
		return "/index";
	}
	
	@RequestMapping("/toIndex")
	public String toIndex(){
		return "/index";
	}
	
	@RequestMapping("/cus-info")
	@ResponseBody
	public Customer cusInfo(){
		return customerService.getOneCustomer(1);
	}
	
	@RequestMapping("/cus-all")
	@ResponseBody
	public List<Customer> cusAll(){
		return customerService.getCustomerList();
	}
}
